#include "view.h"
#include "scene.h"

namespace Opl { namespace Gui{

		class ViewPrivate{
		public:
			ViewPrivate():scene(0) {}
			~ViewPrivate() {}

			Scene* scene;
		};

		View::View() :
				O_PRIVATE_CREATE(View)
		{
			O_D(View);

		}

		View::~View()
		{
			O_PRIVATE_DELETE;
		}


		void View::setScene(Scene *scene)
		{
			QGraphicsView::setScene(scene);

			O_D(View);
			d->scene = scene;
			//d->scene->viewResized(this);
		}

		void View::resizeEvent(QResizeEvent *event)
		{
			O_D(View);
			if (scene())
				scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
			QGraphicsView::resizeEvent(event);
		}

	};};
